<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>
<style>
    .transition{
        transition: 3s background-color ease;
    }
    .red{
        background-color: red;
    }
    .green{
        background-color: greenyellow;
    }
</style>
<body>
    <div id="app"></div>
</body>
<script>
    const app = Vue.createApp({
        data(){
            return{
                // 数据项--------------是否显示，一定要有外层包裹
                css:{
                    transition:true,
                    red:true,
                    green:false
                }
               
            }
        },
        methods:{
            guodu(){
                this.css.red = !this.css.red,
                this.css.green = !this.css.green
            }
        },
        template:`<div :class="css" @click="guodu()">过渡效果</div>`
    })
    app.mount("#app")
</script>
</html>